<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>测试跨域</title>
        <script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
        <script>
            $(function(){
                $(document).on("click","#cors",function(){
                    $.ajax({
                        type:'POST',
                        datatype:'json',
                        url:"192.168.0.2:9001/cors",
                        success:function(data){
                            console.log(data);
                        },
                        error:function(){
                            console.log("网络异常，稍后重试!");
                        }
                    })
                });
            });
        </script>
    </head>
    <body>
        <div style="width:1366px;margin:0 auto">
            <div>
                测试跨域<span id="cors" style="width:80px;height:30px;line-height:30px;background:#333;">测试跨域</span>
            </div>
        </div>
    </body>
</html>